﻿<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="utf-8" />
  	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Dreamer CMS - 后台管理系统</title> 
    <link href="/resource/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="/resource/css/style.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div class="row">
    <div class="col-md-12">
    	<h1 class="panel-heading">编辑任务</h1>
        <!--breadcrumbs start -->
        <ul class="breadcrumb">
			<li><a href="/admin/dashboard/toIndex"><i class="fa fa-home"></i> 首页</a></li>
			<li class="active">编辑任务</li>
		</ul>
        <!--breadcrumbs end -->
    </div>
</div>
<section class="panel">
	<div class="panel-body">
		<form class="col s12" id="form1" th:action="@{/admin/task/update}" onsubmit="return validateForm();" method="post">
			<input type="hidden" th:value="${scheduled.id}" id="id" name="id"/>
			<div class="form-group form-control-medium">
				<label for="taskName">任务名称：</label>
				<input id="taskName" name="taskName" type="text" th:value="${scheduled.taskName}" class="form-control" placeholder="任务名称" />
			</div>
			<div class="form-group form-control-large">
				<label for="clazzName">完整类路径：</label>
				<input id="clazzName" name="clazzName" type="text" th:value="${scheduled.clazzName}" class="form-control" placeholder="完整类路径" />
			</div>
			<div class="form-group form-control-medium">
				<label for="cronExpression">Cron表达式：</label>
				<input id="cronExpression" name="cronExpression" type="text" th:value="${scheduled.cronExpression}" class="form-control" placeholder="Cron表达式" />
			</div>
			<div class="form-group form-control-medium">
				<label for="remark">备注：</label>
				<textarea rows="5" name="remark" class="form-control" th:text="${scheduled.remark}" placeholder="备注"></textarea>
			</div>
			<div class="form-group form-control-medium">
				<label for="status">状态：</label>
				<input id="status-yes" name="status" type="radio" value="1" th:checked="${scheduled.status} == 1" /> 有效
				<input id="status-no" name="status" type="radio" value="0" th:checked="${scheduled.status} == 0" /> 无效
			</div>
			<div class="form-btn-group-left" shiro:hasAnyPermissions="system:task:toedit,system:task:update">
            	<button type="submit" class="btn btn-info">保存</button>
            </div>
		</form>
	</div>
</section>
<script src="/resource/js/jquery.min.js"></script>
<script src="/resource/js/coco-message/coco-message.js"></script>
<script th:inline="javascript">
   	/* 保存方法 */
    function validateForm(){
    	var taskName = $("#taskName").val();
    	var clazzName = $("#clazzName").val();
    	var cronExpression = $("#cronExpression").val();
    	if(taskName == null || taskName==''){
			cocoMessage.error("任务名称不能为空");
    		return false;
    	}
    	if(clazzName == null || clazzName==''){
			cocoMessage.error("完整类路径不能为空");
    		return false;
    	}
    	if(cronExpression == null || cronExpression==''){
			cocoMessage.error("Cron表达式不能为空");
    		return false;
    	}
    	return true;
    }
</script>
</body>
</html>
